require "test/unit"
require "../main/TaskManager"
require "../main/model/Task"

class TaskManagerTest  < Test::Unit::TestCase
  
  def setup
    @manager = TaskManager.new Array.new
  end
  
  def testDeleteTaskAndChildrenById
  	task_1 = Task.new
  	task_1.id = "1"
  	task_11 = Task.new
  	task_11.id = "11"
  	task_11.parentId="1"
  	task_111 = Task.new
  	task_111.id = "111"
  	task_111.parentId="11"
		task_12 = Task.new
		task_12.id = "12"
		task_12.parentId="1"
		task_121 = Task.new
		task_121.id = "121"
		task_121.parentId="12"
		
		@manager.addTask task_1
		@manager.addTask task_11
		@manager.addTask task_111
		@manager.addTask task_12
		@manager.addTask task_121
		
		assert_equal @manager.getTasks.length,5
		@manager.deleteTaskAndChildrenById "1"
		assert_equal @manager.getTasks.length,0
  end
  
  
  
end
